Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update Tendermint genesis #917

Merged
merged 6 commits into from
Jun 25, 2021

Conversation

tzemanovic
Copy link
Contributor

@tzemanovic tzemanovic commented Jun 23, 2021

closes #916

  • Referenced an issue explaining the need for the change
  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Added entry in .changelog/

@tzemanovic tzemanovic changed the title Tomas/update genesis update Tendermint genesis Jun 23, 2021
@codecov-commenter
Copy link

codecov-commenter commented Jun 23, 2021

Codecov Report

Merging #917 (e5b64c3) into master (21ef18f) will decrease coverage by 0.0%.
The diff coverage is 83.3%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master    #917     +/-   ##
========================================
- Coverage    70.6%   70.6%   -0.1%     
========================================
  Files         203     203             
  Lines       16217   16230     +13     
========================================
- Hits        11465   11464      -1     
- Misses       4752    4766     +14     
Impacted Files Coverage Δ
tendermint/src/block/size.rs 12.5% <ø> (ø)
tendermint/src/genesis.rs 100.0% <ø> (ø)
tendermint/src/validator.rs 69.8% <72.7%> (-0.2%) ⬇️
light-client/src/operations/voting_power.rs 95.2% <100.0%> (-0.1%) ⬇️
rpc/tests/kvstore_fixtures.rs 95.4% <100.0%> (ø)
rpc/tests/parse_response.rs 98.0% <100.0%> (ø)
testgen/src/validator.rs 84.5% <100.0%> (+0.1%) ⬆️
tendermint/src/node/info.rs 52.6% <0.0%> (-9.9%) ⬇️
testgen/src/light_block.rs 76.0% <0.0%> (-9.6%) ⬇️
tendermint/src/block/commit_sig.rs 77.2% <0.0%> (-2.3%) ⬇️
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 21ef18f...e5b64c3. Read the comment docs.

@tzemanovic tzemanovic marked this pull request as ready for review June 23, 2021 17:49
Copy link
Contributor

@thanethomson thanethomson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one question from my side. Otherwise looks good! 🙏

@@ -24,25 +25,9 @@ pub struct Genesis<AppState = serde_json::Value> {
pub validators: Vec<validator::Info>,

/// App hash
#[serde(skip_serializing_if = "Vec::is_empty", with = "serde_bytes")]
pub app_hash: Vec<u8>,
pub app_hash: String,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's your reasoning behind this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our app, we're updating the genesis.json generated from Tendermint Go. It sets "app_hash": "", which is parsed as an empty Vec, but when we serialize it back to json, it omits the field completely. Then on subsequent run, the parser fails due to Error("missing field app_hash", ...)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And what if you changed it to:

Suggested change
pub app_hash: String,
#[serde(with = "serde_bytes")]
pub app_hash: Vec<u8>,

In the Go version of Tendermint it's modeled as HexBytes, which is an array of bytes, and I think it should be modeled similarly here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unfortunately, this writes back "app_hash": [] into JSON, which is not accepted :/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps this could use a custom serialize/deserialize with hex encoding/decoding

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#[serde(with="serializers::bytes::hexstring")] does it, I'll fix it up

Copy link
Contributor

@thanethomson thanethomson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

@thanethomson thanethomson merged commit c8b97aa into informalsystems:master Jun 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tendermint genesis is outdated
3 participants